<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The RecursiveTreeIterator class</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="recursiveregexiterator.haschildren.html">« RecursiveRegexIterator::hasChildren</a></li>
      <li style="float: right;"><a href="recursivetreeiterator.beginchildren.html">RecursiveTreeIterator::beginChildren »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="spl.iterators.html">迭代器</a></li>
    <li>The RecursiveTreeIterator class</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="class.recursivetreeiterator" class="reference">

 <h1 class="title">The RecursiveTreeIterator class</h1>
 

 <div class="partintro"><p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8)</p>


  <div class="section" id="recursivetreeiterator.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    Allows iterating over a <span class="classname"><a href="class.recursiveiterator.html" class="classname">RecursiveIterator</a></span> to generate an ASCII graphic tree.
   </p>
  </div>


  <div class="section" id="recursivetreeiterator.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass">
     
    </div>

    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">class</span> <strong class="classname">RecursiveTreeIterator</strong>
     </span>

     <span class="ooclass">
      <span class="modifier">extends</span>
       <a href="class.recursiveiteratoriterator.html" class="classname">RecursiveIteratorIterator</a>
     </span>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 继承的常量 */</div>
    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.recursiveiteratoriterator.html#recursiveiteratoriterator.constants.leaves-only"><var class="varname">RecursiveIteratorIterator::LEAVES_ONLY</var></a></var>;</div>
<div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.recursiveiteratoriterator.html#recursiveiteratoriterator.constants.self-first"><var class="varname">RecursiveIteratorIterator::SELF_FIRST</var></a></var>;</div>
<div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.recursiveiteratoriterator.html#recursiveiteratoriterator.constants.child-first"><var class="varname">RecursiveIteratorIterator::CHILD_FIRST</var></a></var>;</div>
<div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.recursiveiteratoriterator.html#recursiveiteratoriterator.constants.catch-get-child"><var class="varname">RecursiveIteratorIterator::CATCH_GET_CHILD</var></a></var>;</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 常量 */</div>
    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.recursivetreeiterator.html#recursivetreeiterator.constants.bypass-current"><var class="varname">BYPASS_CURRENT</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.recursivetreeiterator.html#recursivetreeiterator.constants.bypass-key"><var class="varname">BYPASS_KEY</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.recursivetreeiterator.html#recursivetreeiterator.constants.prefix-left"><var class="varname">PREFIX_LEFT</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.recursivetreeiterator.html#recursivetreeiterator.constants.prefix-mid-has-next"><var class="varname">PREFIX_MID_HAS_NEXT</var></a></var><span class="initializer"> = 1</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.recursivetreeiterator.html#recursivetreeiterator.constants.prefix-mid-last"><var class="varname">PREFIX_MID_LAST</var></a></var><span class="initializer"> = 2</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.recursivetreeiterator.html#recursivetreeiterator.constants.prefix-end-has-next"><var class="varname">PREFIX_END_HAS_NEXT</var></a></var><span class="initializer"> = 3</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.recursivetreeiterator.html#recursivetreeiterator.constants.prefix-end-last"><var class="varname">PREFIX_END_LAST</var></a></var><span class="initializer"> = 4</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.recursivetreeiterator.html#recursivetreeiterator.constants.prefix-right"><var class="varname">PREFIX_RIGHT</var></a></var><span class="initializer"> = 5</span>;</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="recursivetreeiterator.construct.html" class="methodname">__construct</a></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="class.recursiveiterator.html" class="type RecursiveIterator">RecursiveIterator</a></span>|<span class="type"><a href="class.iteratoraggregate.html" class="type IteratorAggregate">IteratorAggregate</a></span></span> <code class="parameter">$iterator</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code><span class="initializer"> = RecursiveTreeIterator::BYPASS_KEY</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">int</span> <code class="parameter">$cachingIteratorFlags</code><span class="initializer"> = CachingIterator::CATCH_GET_CHILD</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">int</span> <code class="parameter">$mode</code><span class="initializer"> = RecursiveTreeIterator::SELF_FIRST</span></span><br>)</div>

    <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursivetreeiterator.beginchildren.html" class="methodname">beginChildren</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursivetreeiterator.beginiteration.html" class="methodname">beginIteration</a></span>(): <span class="type"><a href="class.recursiveiterator.html" class="type RecursiveIterator">RecursiveIterator</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursivetreeiterator.callgetchildren.html" class="methodname">callGetChildren</a></span>(): <span class="type"><a href="class.recursiveiterator.html" class="type RecursiveIterator">RecursiveIterator</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursivetreeiterator.callhaschildren.html" class="methodname">callHasChildren</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursivetreeiterator.current.html" class="methodname">current</a></span>(): <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursivetreeiterator.endchildren.html" class="methodname">endChildren</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursivetreeiterator.enditeration.html" class="methodname">endIteration</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursivetreeiterator.getentry.html" class="methodname">getEntry</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursivetreeiterator.getpostfix.html" class="methodname">getPostfix</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursivetreeiterator.getprefix.html" class="methodname">getPrefix</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursivetreeiterator.key.html" class="methodname">key</a></span>(): <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursivetreeiterator.next.html" class="methodname">next</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursivetreeiterator.nextelement.html" class="methodname">nextElement</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursivetreeiterator.rewind.html" class="methodname">rewind</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursivetreeiterator.setpostfix.html" class="methodname">setPostfix</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$postfix</code></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursivetreeiterator.setprefixpart.html" class="methodname">setPrefixPart</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$part</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$value</code></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursivetreeiterator.valid.html" class="methodname">valid</a></span>(): <span class="type">bool</span></div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 继承的方法 */</div>
    <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursiveiteratoriterator.beginchildren.html" class="methodname">RecursiveIteratorIterator::beginChildren</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursiveiteratoriterator.beginiteration.html" class="methodname">RecursiveIteratorIterator::beginIteration</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursiveiteratoriterator.callgetchildren.html" class="methodname">RecursiveIteratorIterator::callGetChildren</a></span>(): <span class="type"><span class="type">?</span><span class="type"><a href="class.recursiveiterator.html" class="type RecursiveIterator">RecursiveIterator</a></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursiveiteratoriterator.callhaschildren.html" class="methodname">RecursiveIteratorIterator::callHasChildren</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursiveiteratoriterator.current.html" class="methodname">RecursiveIteratorIterator::current</a></span>(): <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursiveiteratoriterator.endchildren.html" class="methodname">RecursiveIteratorIterator::endChildren</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursiveiteratoriterator.enditeration.html" class="methodname">RecursiveIteratorIterator::endIteration</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursiveiteratoriterator.getdepth.html" class="methodname">RecursiveIteratorIterator::getDepth</a></span>(): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursiveiteratoriterator.getinneriterator.html" class="methodname">RecursiveIteratorIterator::getInnerIterator</a></span>(): <span class="type"><a href="class.recursiveiterator.html" class="type RecursiveIterator">RecursiveIterator</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursiveiteratoriterator.getmaxdepth.html" class="methodname">RecursiveIteratorIterator::getMaxDepth</a></span>(): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursiveiteratoriterator.getsubiterator.html" class="methodname">RecursiveIteratorIterator::getSubIterator</a></span>(<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">int</span><span class="type"></span></span> <code class="parameter">$level</code><span class="initializer"> = <strong><code>null</code></strong></span></span>): <span class="type"><span class="type">?</span><span class="type"><a href="class.recursiveiterator.html" class="type RecursiveIterator">RecursiveIterator</a></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursiveiteratoriterator.key.html" class="methodname">RecursiveIteratorIterator::key</a></span>(): <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursiveiteratoriterator.next.html" class="methodname">RecursiveIteratorIterator::next</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursiveiteratoriterator.nextelement.html" class="methodname">RecursiveIteratorIterator::nextElement</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursiveiteratoriterator.rewind.html" class="methodname">RecursiveIteratorIterator::rewind</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursiveiteratoriterator.setmaxdepth.html" class="methodname">RecursiveIteratorIterator::setMaxDepth</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$maxDepth</code><span class="initializer"> = -1</span></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="recursiveiteratoriterator.valid.html" class="methodname">RecursiveIteratorIterator::valid</a></span>(): <span class="type">bool</span></div>

   }</div>


  </div>
  

  <div class="section" id="recursivetreeiterator.constants">
   <h2 class="title">预定义常量</h2>
   <dl>

    
     <dt id="recursivetreeiterator.constants.bypass-current"><strong><code>RecursiveTreeIterator::BYPASS_CURRENT</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    

    
     <dt id="recursivetreeiterator.constants.bypass-key"><strong><code>RecursiveTreeIterator::BYPASS_KEY</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    

    
     <dt id="recursivetreeiterator.constants.prefix-left"><strong><code>RecursiveTreeIterator::PREFIX_LEFT</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    

    
     <dt id="recursivetreeiterator.constants.prefix-mid-has-next"><strong><code>RecursiveTreeIterator::PREFIX_MID_HAS_NEXT</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    

    
     <dt id="recursivetreeiterator.constants.prefix-mid-last"><strong><code>RecursiveTreeIterator::PREFIX_MID_LAST</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    

    
     <dt id="recursivetreeiterator.constants.prefix-end-has-next"><strong><code>RecursiveTreeIterator::PREFIX_END_HAS_NEXT</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    

    
     <dt id="recursivetreeiterator.constants.prefix-end-last"><strong><code>RecursiveTreeIterator::PREFIX_END_LAST</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    

    
     <dt id="recursivetreeiterator.constants.prefix-right"><strong><code>RecursiveTreeIterator::PREFIX_RIGHT</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    

   </dl>

  </div>



 </div>

 

























































































































<h2>目录</h2><ul class="chunklist chunklist_reference"><li><a href="recursivetreeiterator.beginchildren.html">RecursiveTreeIterator::beginChildren</a> — Begin children</li><li><a href="recursivetreeiterator.beginiteration.html">RecursiveTreeIterator::beginIteration</a> — Begin iteration</li><li><a href="recursivetreeiterator.callgetchildren.html">RecursiveTreeIterator::callGetChildren</a> — Get children</li><li><a href="recursivetreeiterator.callhaschildren.html">RecursiveTreeIterator::callHasChildren</a> — Has children</li><li><a href="recursivetreeiterator.construct.html">RecursiveTreeIterator::__construct</a> — Construct a RecursiveTreeIterator</li><li><a href="recursivetreeiterator.current.html">RecursiveTreeIterator::current</a> — Get current element</li><li><a href="recursivetreeiterator.endchildren.html">RecursiveTreeIterator::endChildren</a> — End children</li><li><a href="recursivetreeiterator.enditeration.html">RecursiveTreeIterator::endIteration</a> — End iteration</li><li><a href="recursivetreeiterator.getentry.html">RecursiveTreeIterator::getEntry</a> — Get current entry</li><li><a href="recursivetreeiterator.getpostfix.html">RecursiveTreeIterator::getPostfix</a> — Get the postfix</li><li><a href="recursivetreeiterator.getprefix.html">RecursiveTreeIterator::getPrefix</a> — Get the prefix</li><li><a href="recursivetreeiterator.key.html">RecursiveTreeIterator::key</a> — Get the key of the current element</li><li><a href="recursivetreeiterator.next.html">RecursiveTreeIterator::next</a> — Move to next element</li><li><a href="recursivetreeiterator.nextelement.html">RecursiveTreeIterator::nextElement</a> — Next element</li><li><a href="recursivetreeiterator.rewind.html">RecursiveTreeIterator::rewind</a> — Rewind iterator</li><li><a href="recursivetreeiterator.setpostfix.html">RecursiveTreeIterator::setPostfix</a> — Set postfix</li><li><a href="recursivetreeiterator.setprefixpart.html">RecursiveTreeIterator::setPrefixPart</a> — Set a part of the prefix</li><li><a href="recursivetreeiterator.valid.html">RecursiveTreeIterator::valid</a> — Check validity</li></ul>
</div>
</div></div></body></html>